from five import grok
from zope import schema
from plone.directives import form

from zope.interface import Invalid

from plumvillage.registration import PlumVillageMessageFactory as _

# Indexer
from plone.indexer import indexer

# Uniqueness validator
from z3c.form import validator
from plone.uuid.interfaces import IUUID
from Products.CMFCore.utils import getToolByName

class IRoom(form.Schema):
    """Describes a room
    """
    capacity = schema.Int(
            title=_(u'Capacity'),
            description=_(u"The number of people the room can house"),
            required=True
        )

class View(grok.View):
    """Default view (called "@@view"") for a room.
    
    The associated template is found in room_templates/view.pt.
    """
    
    grok.context(IRoom)
    grok.require('zope2.View')
    grok.name('view')
    
    def update(self):
        """Prepare information for the template
        """
        pass 
